package basic_1007;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner scanner=new Scanner(System.in);
		
		String A=scanner.next();
		int B=scanner.nextInt();
		
		scanner.close();
		
		String Q="";
		int r=0;
		for(int i=0;i<A.length();i++) {
			int num=r*10+Integer.parseInt(""+A.charAt(i));
			int qi=num/B;
			r=num%B;
			Q=Q+qi;
		}
		
		Q=Q.startsWith("0")?Q.substring(1):Q;
		System.out.print(Q+" "+r);

	}

}
